using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using MvcShop.Models.Repositories;
using MvcShop.Models;

namespace MvcShop.MVC.Controllers
{
    public class NewsController : BaseController
    {
        //
        // GET: /News/
        #region ==== Fields ====
        private readonly INewsRepository<News> _newsRepository;
        #endregion

        #region ==== Constructors ====
        public NewsController(INewsRepository<News> newsRepository)
        {
            this._newsRepository = newsRepository;
        }
        #endregion

        public ActionResult Index(int newsId, int year, int month, int day)
        {
            var news = this._newsRepository.Find(newsId);

            #region === BaseController ===
            this.Title = news.Title;
            this.Keywords = news.Title;
            this.Description = news.Title;
            #endregion

            return View(news);
        }

        //public ActionResult Index(string date, int newsId)
        //{
        //    var news = this._newsRepository.Find(newsId);

        //    #region === BaseController ===
        //    this.Title = news.Title;
        //    this.Keywords = news.Title;
        //    this.Description = news.Title;
        //    #endregion

        //    return View(news);
        //}

    }
}
